package com.fengye.security.captcha.authentication.security.beans;

import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

/**
 *
 * @author sky
 * @date 2021年06月01日 11:58 上午
 */
@Component
public class MyUserDetailsService implements UserDetailsService {
    @Override
    public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
        return User.withUsername(s).password("123").authorities(AuthorityUtils.commaSeparatedStringToAuthorityList("USER,ADMIN"))
                .build();
    }
}
